package com.linkhub.oms.data.sync.service.impl;

import com.dtflys.forest.http.ForestResponse;
import com.linkhub.oms.data.sync.api.yunexpress.client.OMSYunExpressClient;
import com.linkhub.oms.data.sync.api.yunexpress.domain.request.CreateOrderRequest;
import com.linkhub.oms.data.sync.api.yunexpress.domain.request.GetTrackingNumberRequest;
import com.linkhub.oms.data.sync.api.yunexpress.domain.request.InterceptRequest;
import com.linkhub.oms.data.sync.api.yunexpress.domain.request.PriceTrialRequest;
import com.linkhub.oms.data.sync.api.yunexpress.domain.response.*;
import com.linkhub.oms.data.sync.service.OMSYunExpressApiService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description: OMSYunExpressApiService
 * @Author: echo
 * @Date: 2024/5/27 16:49
 * @Version: 1.0
 */
@Slf4j
@Service
public class OMSYunExpressApiServiceImpl implements OMSYunExpressApiService {
    @Resource
    private OMSYunExpressClient yunExpressClient;
    @Override
    public PriceTrialResponse getPriceTrial(PriceTrialRequest request) {
        ForestResponse<PriceTrialResponse> forestResponse = yunExpressClient.getPriceTrial(request);
        return forestResponse.getResult();
    }

    @Override
    public InterceptResponse intercept( InterceptRequest request ) {
        ForestResponse<InterceptResponse> forestResponse = yunExpressClient.intercept(request);
        return forestResponse.getResult();
    }

    @Override
    public CreateOrderResponse createOrder( List<CreateOrderRequest> requests ) {
        ForestResponse<CreateOrderResponse> forestResponse = yunExpressClient.createOrder(requests);
        return forestResponse.getResult();
    }

    @Override
    public PrintOrderResponse printOrder( List<String> requests ) {
        ForestResponse<PrintOrderResponse> forestResponse = yunExpressClient.printOrder(requests);
        return forestResponse.getResult();
    }

    @Override
    public GetTrackingNumberResponse getTrackingNumber( GetTrackingNumberRequest requests ) {
        ForestResponse<GetTrackingNumberResponse> forestResponse = yunExpressClient.getTrackingNumber(requests);
        return forestResponse.getResult();
    }
}
